home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWRgnShp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.5 KB  |  156 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRgnShp.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWRGNSHP_H
  11. #define FWRGNSHP_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWDEBUG_H
  20. #include "FWDebug.h"
  21. #endif
  22.  
  23. #ifndef FWSOMENV_H
  24. #include "FWSOMEnv.h"
  25. #endif
  26.  
  27. // ----- OpenDoc Includes -----
  28.  
  29. #ifndef SOM_ODShape_xh
  30. #include <Shape.xh>
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward Declarations
  35. //========================================================================================
  36.  
  37. class FW_CGraphicContext;
  38.  
  39. //========================================================================================
  40. //    class FW_CRegionShape
  41. //========================================================================================
  42.  
  43. class FW_CRegionShape : public FW_CShape
  44. {
  45. public:
  46.     FW_DECLARE_CLASS
  47.     FW_DECLARE_AUTO(FW_CRegionShape)
  48.  
  49. //----------------------------------------------------------------------------------------
  50. //    Constructors/Destructors
  51. //
  52. public:
  53.     FW_CRegionShape(ODShape* odShape,
  54.                     FW_ERenderVerbs renderVerb,
  55.                     const FW_CInk& ink = FW_kNormalInk,
  56.                     const FW_CStyle& style = FW_kNormalStyle);
  57.     
  58.     FW_CRegionShape(const FW_CRegionShape& other);
  59.     FW_CRegionShape(FW_CReadableStream& stream);
  60.     
  61.     virtual ~ FW_CRegionShape();
  62.  
  63. //----------------------------------------------------------------------------------------
  64. //    Operators
  65. //
  66. public:
  67.     FW_CRegionShape& operator=(const FW_CRegionShape& other);
  68.     
  69. //----------------------------------------------------------------------------------------
  70. //    Inherited API
  71. //
  72. public:
  73.     // ----- Hit Testing -----
  74.     virtual FW_Boolean     HitTest(FW_CGraphicContext& gc,
  75.                                     const FW_CPoint& test,
  76.                                     FW_Fixed tolerance) const;
  77.  
  78.     // ----- Copying -----
  79.     virtual FW_CShape*        Copy() const;
  80.     
  81.     // ----- Transform -----
  82.     virtual void            Transform(Environment* ev, ODTransform* odTransform);
  83.     virtual void            InverseTransform(Environment* ev, ODTransform* odTransform);
  84.  
  85.     virtual void            MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
  86.     virtual void            MoveShapeTo(FW_Fixed x, FW_Fixed y);
  87.  
  88.     virtual void            Inset(FW_Fixed h, FW_Fixed v);
  89.  
  90.     // ----- Geometry -----
  91.     virtual void             GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
  92.  
  93.     // ----- Anchor Point -----
  94.     virtual FW_CPoint        GetAnchorPoint() const;
  95.     
  96.     // ----- Rendering -----
  97.     virtual void            Render(FW_CGraphicContext& gc) const;
  98.     
  99.     // ----- Flatten -----
  100.     virtual void            Flatten(FW_CWritableStream& stream) const;
  101.     
  102. //----------------------------------------------------------------------------------------
  103. //    New API
  104. //
  105. public:    
  106.     // ----- Rendering -----
  107.     static void            RenderRegion(FW_CGraphicContext& gc,
  108.                                         ODShape* odShape,
  109.                                         FW_ERenderVerbs renderVerb,
  110.                                         const FW_CInk& ink = FW_kNormalInk,
  111.                                         const FW_CStyle& style = FW_kNormalStyle);
  112.     
  113.     // ----- Archiving -----
  114.     static void*             Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  115.  
  116.     // ----- Getter/Setters -----
  117.     void                    GetGeometry(ODShape* odShape) const;        // returns a copy
  118.     void                    SetGeometry(ODShape* odShape);            // use a copy        
  119.     
  120.     ODShape*                GetODShape() const;                        // return fODShape                        
  121.     void                    AdoptODShape(ODShape* newODShape);        // Doesn't use a copy
  122.     ODShape*                OrphanODShape();                            //
  123.  
  124. private:
  125.     void                    DisposeODShape(Environment* ev);
  126.     
  127. //----------------------------------------------------------------------------------------
  128. //    Data Members
  129. //
  130. private:
  131.     ODShape                *fODShape;        
  132. };
  133.  
  134. //========================================================================================
  135. //    inlines
  136. //========================================================================================
  137.  
  138. //----------------------------------------------------------------------------------------
  139. //    FW_CRegionShape::GetODShape
  140. //----------------------------------------------------------------------------------------
  141. inline ODShape* FW_CRegionShape::GetODShape() const
  142. {
  143.     return fODShape;
  144. }
  145.  
  146. //----------------------------------------------------------------------------------------
  147. //    FW_CRegionShape::GetGeometry
  148. //----------------------------------------------------------------------------------------
  149. inline void FW_CRegionShape::GetGeometry(ODShape* odShape) const
  150. {
  151.     FW_SOMEnvironment ev;
  152.     odShape->CopyFrom(ev, fODShape);    // [HLX] for now
  153. }
  154.  
  155. #endif
  156.